﻿<Window x:Class="Serietheque.Fenetres.EditEpisodeWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:src="clr-namespace:Serietheque.Fenetres"
        Title="ModifierEpisode" WindowStyle="ToolWindow" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" SizeToContent="WidthAndHeight">
    <Window.Resources>

        <!-- Probleme validation et update source casse couille, on verra plus tard-->
        <!--The tool tip for the TextBox to display the validation error message.-->
        <ControlTemplate x:Key="InputErrorTemplate">
            <DockPanel>
                <Ellipse DockPanel.Dock="Right" Margin="2,0" ToolTip="Contains invalid data" Width="10" Height="10">
                    <Ellipse.Fill>
                        <LinearGradientBrush>
                            <GradientStop Color="#11FF1111" Offset="0" />
                            <GradientStop Color="#FFFF0000" Offset="1" />
                        </LinearGradientBrush>
                    </Ellipse.Fill>
                </Ellipse>
                <Border BorderBrush="Red" BorderThickness="1">
                    <AdornedElementPlaceholder />
                </Border>
            </DockPanel>
        </ControlTemplate>
        <Style TargetType="TextBox">
            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource InputErrorTemplate}" />
        </Style>
        <Style TargetType="RadioButton">
            <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
        </Style>
        <Style TargetType="DatePicker">
            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource InputErrorTemplate}" />
        </Style>
        <Style TargetType="StackPanel">
            <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Name="skp" Loaded="skp_Loaded" Grid.Row="0">
            <StackPanel.BindingGroup>
                <BindingGroup>
                    <BindingGroup.ValidationRules>
                        <src:VR ValidationStep="UpdatedValue" ValidatesOnTargetUpdated="True"/>
                    </BindingGroup.ValidationRules>
                </BindingGroup>

            </StackPanel.BindingGroup>
            <StackPanel Margin="5,0">
                <TextBlock Text="{Binding FilePath}" FontWeight="Bold" TextWrapping="Wrap" />
                <Label>Nom de la serie :</Label>
                <TextBox Text="{Binding Serie,ValidatesOnDataErrors=True}" TextChanged="OnCommitBindingGroup" />
                <Label>Numero Saison :</Label>
                <TextBox Text="{Binding Saison, ConverterCulture=fr-FR,StringFormat={}{0:G},ValidatesOnDataErrors=True}" TextChanged="OnCommitBindingGroup" Margin="0,0,131,0" />
                <Label>Numero Episode :</Label>
                <TextBox Text="{Binding Episode, ConverterCulture=fr-FR,StringFormat={}{0:G},ValidatesOnDataErrors=True}" TextChanged="OnCommitBindingGroup" Margin="0,0,131,0"/>
                <!--<Label>Nom de l'Episode</Label>
                <TextBox Text="{Binding Name}"/>-->
            </StackPanel>

        </StackPanel>
        <StackPanel Orientation="Horizontal" Margin="5" Grid.Row="1">
            <Button Name="ok" Width="83" Content="Ok!" Margin="0,0,5,0" IsDefault="True" Click="ok_Click" />
            <Button Name="annuler" Width="83"  Content="Annuler" Click="annuler_Click" />
        </StackPanel>
    </Grid>
</Window>